<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jsfor循环</title>
</head>
<body>
<script>
    var x
    var mycars = new Array()
    mycars[0] = "Saab"
    mycars[1] = "Volvo"
    mycars[2] = "BMW"

    for (x in mycars)
    {
        document.write(mycars[x] + "<br />")
    }
</script>
</body>
</html>